extends ./layouts/main

block style
	link(href='/style/form.less' rel="stylesheet/less")

block content
	form(id='form').form-group
		input(type='text' name='userName' id='user').form-control
		input(type='password' name='password' id='pwd').form-control
		input(type='submit' value='submit').form-control
	a(href='/forget') 忘记密码
	a(href='/register') 注册
	script.
		$('#form').on('submit',function (evt) {

			evt.preventDefault();
			$.ajax({
				url:'/user/login',
				method:'POST',
				dataType:'json',
				data:{
					userName:$('#user').val(),
					password:$('#pwd').val()
				},
				success:function (data) {
					if(data.returnCode === 0) {
						window.location.href = '/home';
					}
				}
			})
		})
